<?php
class config{
	public function init($params=array()){
		$this->db=$this->yum->library('mysql');
		$this->prefix=$this->yum->vars('app','prefix');
	}
    public function GConfig($params=array()){
    	return $this->db->select($this->prefix.'config',$params);
    }
	public function IConfig($params){
		return $this->db->insert($this->prefix.'config',$params);
	}
	public function RConfig($params){
		return $this->db->replace($this->prefix.'config',$params);
	}
	public function UConfig($params){
		return $this->db->update($this->prefix.'config',$params);
	}
	public function parse($html,$params=array()){
		$standard=array('site'=>name,'domain'=>domain,'date'=>date('Y-m-d H:i:s',$this->yum->runtime));
		$html=str_replace(array('&amp;','&quot;','&#039;','&lt;','&gt;'),array('&','"','\'','<','>'),$html);
		$params=array_merge($params,$standard);
		foreach($params as $key=>$value){
			$html=str_replace("{\$".$key."}",$value,$html);
		}
		return $html;
	}
}
?>